package com.hongtech.modules.app.service.impl;

import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
import com.hongtech.common.service.impl.CrudServiceImpl;
import com.hongtech.common.util.BeanCopierUtils;
import com.hongtech.modules.app.dto.UserDTO;
import com.hongtech.modules.app.entity.UserEntity;
import com.hongtech.modules.app.mapper.UserMapper;
import com.hongtech.modules.app.service.UserService;
import org.springframework.stereotype.Service;

@Service("userService")
public class UserServiceImpl extends CrudServiceImpl<UserMapper, UserEntity, UserDTO> implements UserService {

    @Override
    public UserDTO queryByMobile(String mobile) {
        LambdaQueryWrapper<UserEntity> queryWrapper = new LambdaQueryWrapper<>();
        queryWrapper.eq(UserEntity::getMobile, mobile);
        UserEntity userEntity = baseDao.selectOne(queryWrapper);
        return BeanCopierUtils.copyProperties(userEntity, UserDTO.class);
    }

}
